package com.test.Interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * WebMvcConfig
 *
 * @author HY
 * 2021/05/13 20:48
 **/


@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册一个拦截器   未登录拦截
        registry.addInterceptor(new LoginInterceptor())
                /*指定拦截器要拦截的请求(支持*通配符)*/
                .addPathPatterns("*.do")
                //指定拦截器不拦截的请求(支持*通配符)
                .excludePathPatterns("/Login");
    }


}
